Vectors

Vectors are heterogenous structures whose elements are indexed by integers. A vector typically occupies less space than a list of the same length, and the average time required to access a randomly chosen element is typically less for the vector than for the list.

The <#1528#>length<#1528#> of a vector is the number of elements that it contains. This number is a non-negative integer that is fixed when the vector is created. The <#1529#>valid indexes<#1529#> of a vector are the exact non-negative integers less than the length of the vector. The first element in a vector is indexed by zero, and the last element is indexed by one less than the length of the vector.

Vectors are written using the notation <#2202#>#(<#1531#>obj<#1531#> )<#2202#>. For example, a vector of length 3 containing the number zero in element 0, the list <#1532#>(2 2 2 2)<#1532#> in element 1, and the string <#1533#>;SPMquot;Anna;SPMquot;<#1533#> in element 2 can be written as following:


#scheme1534#

Note that this is the external representation of a vector, not an expression evaluating to a vector. Like list constants, vector constants must be quoted:


#scheme1536#

<#1538#>Pitman sez: The visual similarity to lists is bound to be confusing to some. Elaborate on the distinction.<#1538#>


#entry1539#


#entry1546#


#entry1556#


#entry1564#


#entry1570#


#entry1582#


#entry1596#


#entry1610#